<template>
  <div class="container">
    <div class="button" @click="toQrcode()">生成二维码</div>
    <div class="button" @click="toScan()">扫描二维码</div>
  </div>
</template>

<script lang="ts">
import { defineComponent, onMounted } from 'vue'
import { useRouter } from 'vue-router'

export default defineComponent({
  setup() {
    onMounted(() => {
      //  const wxappId = import.meta.env.VITE_APP_APPID
      // const host = import.meta.env.VITE_APP_BASEURL
      // const redirectUri = encodeURI(host + '/wx/html/index')
      // setTimeout(() => {
      //   window.location.replace(
      //     `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${wxappId}&redirect_uri=${redirectUri}&response_type=code&scope=snsapi_userinfo&state=1&connect_redirect=1#wechat_redirect`
      //   )
      // }, 100)
    })
    const router = useRouter()
    const toQrcode = () => {
      router.push({ name: 'qrcode' })
    }
    const toScan = () => {
      router.push({ name: 'scan' })
    }
    return {
      toQrcode,
      toScan
    }
  }
})
</script>

<style lang="less" scoped>
.container {
  position: absolute;
  height: 100%;
  width: 750px;
}
.button {
  margin: 50px auto;
}
</style>

